// Define our variables
_unit = _this select 0;
_adminVehicles = [HELLCAT, A_LB];
_lifthelis = ["I_Heli_Transport_02_F","I_Heli_light_03_unarmed_F","B_Heli_Transport_01_camo_F","B_Heli_Transport_01_F"];

if(isNull _unit) exitWith {};

// Handle cleanup script issues
/*
if (isServer) then {
	if (isNil DMZ_Excluded) then {
		DMZ_Excluded = [];
	};
	DMZ_Excluded = DMZ_Excluded + [_unit];
};
*/
//No firing in base
_unit addeventhandler ["fired",{  if (vehicle (_this select 0) in list base ) then {deleteVehicle (_this select 6)};}];

//Editable by Zeus
{_x addCuratorEditableObjects [[_unit],true];} forEach allCurators;

if (_unit isKindOf "Helicopter") then {
	_unit enableCoPilot false;
	if (_unit in _lifthelis) then {
		[_unit] execVM "scripts\aw_sling\aw_sling_setupUnit.sqf";
	};
	if (_unit isKindOf "B_Heli_Transport_01_camo_F") then {
		_unit removeMagazinesTurret ["2000Rnd_65x39_Belt_Tracer_Red",[1]];	//Remove ammo from side gunners
		_unit removeMagazinesTurret ["2000Rnd_65x39_Belt_Tracer_Red",[2]];	//Remove ammo from side gunners
		//_unit lockturret [[0],true];	//Lock CoPilot
		_unit lockturret [[1],true];	//Lock Left Gunner
		_unit lockturret [[2],true];	//Lock Right Gunner
		_unit addAction ["<t color='#0000f6'>Ammo Drop</t>", "scripts\aw_drop.sqf",[1],0,false,true,""," driver  _target == _this"];
	};
	if ((_unit isKindOf "B_Heli_Light_01_armed_F") OR (_unit isKindOf "B_Heli_Light_01_F")) then {
		if (_unit in _adminVehicles) then {
			_unit setObjectTexture [0,"a3\air_f\Heli_Light_01\Data\Skins\heli_light_01_ext_wasp_co.paa"];
		} else {
			_unit setObjectTexture [0,"a3\air_f\Heli_Light_01\Data\heli_light_01_ext_ion_co.paa"];
		};
	};
	if (!(_unit in _adminVehicles) AND (isServer)) then {
		_unit addEventHandler ["getIn", {
			private ["_player", "_uid", "_position"];
			_player = _this select 2;
			_uid = getPlayerUID _player;
			_position = _this select 1;
			if (!(_player isKindOf "B_Helipilot_F") AND !(_uid in Evo_Admins) AND (_position == "driver") AND (PARAMS_PilotsOnly == 1)) then {
				[[_player, false],"SXP_fnc_getOut", _player] spawn BIS_fnc_MP;
			};
		}];
	};
};
if (_unit isKindOf "LandVehicle") then {
	if (_unit isKindOf "B_Truck_01_covered_F") then {
	[_unit] execVM "arsenal_init.sqf";
	};
	if (_unit isKindOf "B_Truck_01_box_F") then {
	[_unit] execVM "arsenal_init.sqf";
	};
	if (_unit isKindOf "Wheeled_APC_F") then {
		[_unit] execVM "scripts\aw_boatPush\aw_boatPush_setupUnit.sqf";
	};
	if ((_unit isKindOf "B_MRAP_01_F") OR (_unit isKindOf "B_MRAP_01_hmg_F")) then {
		clearItemCargoGlobal _unit;
		clearWeaponCargoGlobal _unit; 
		clearMagazineCargoGlobal _unit;
	};
};
if (_unit isKindOf "Ship") then {
	[_unit] execVM "scripts\aw_boatPush\aw_boatPush_setupUnit.sqf";
	clearItemCargoGlobal _unit;
	clearWeaponCargoGlobal _unit; 
	clearMagazineCargoGlobal _unit;
};

if (_unit in _adminVehicles) then {
	_unit allowdamage false;
	[_unit] execVM "arsenal_init.sqf";
	if (isServer) then {
		_unit addEventHandler ["getIn", {
			private ["_player", "_uid", "_position"];
			_player = _this select 2;
			_uid = getPlayerUID _player;
			_position = _this select 1;
			if (!(_uid in Evo_Admins) AND (_position == "driver")) then {
				[[_player, true],"SXP_fnc_getOut", _player] spawn BIS_fnc_MP;
			};
		}];
	};
};


